<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>个人资料</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/base.css" />
		<script src="js/flexible.js"></script>
		<link rel="stylesheet" href="css/gerenziliao.css" />
		<script src="js/confi.js"></script>
		<script src="js/jquery-3.1.1.js"></script>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">个人资料</h1>
		</header>
		<div class="mui-content">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell" style="line-height: 0.7rem;"><span class="yangshi nicheng"></span><input id="userName" value="" placeholder="请输入用户昵称" /></li>
				<li class="mui-table-view-cell" style="line-height: 0.7rem;"><span class="yangshi shouji"></span><span id="phone"></span></li>
				<li class="mui-table-view-cell te"><span class="yangshi mima"></span><input id="userPassword" type="password" style="width: 85%;" value="" disabled="disabled" /></li>
			</ul>
			<div style="width: 100%;height: 10px;background-color: #ECECEC;"></div>
		</div>
		<div class="mui-content" style="padding-top: 0;">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell te"><span class="yangshi xingming"></span><input id="alipayName" type="text" style="width: 85%;" value="" placeholder="提现支付宝姓名" /></li>
				<li class="mui-table-view-cell te"><span class="yangshi zhanghao"></span><input id="alipay" type="text" style="width: 85%;" value="" placeholder="提现支付宝账号" /></li>
				<li class="mui-table-view-cell te"><span class="yangshi shenfen"></span><input id="idCard" type="text" style="width: 85%;" value="" placeholder="提现身份证" /></li>
			</ul>
		</div>
		<div class="mui-content" style="background: none;">
			<div class="mui-content-padded">
				<button id="btn" type="button" class="personalBtn mui-btn mui-btn-primary mui-btn-block">确认保存</button>
			</div>
		</div>
		<script type="text/javascript" charset="utf-8">
			mui.init();
			//个人资料显示
			var token = localStorage.getItem('token');
			mui.ajax(config.host + '/home/User/perInfoDis', {
				headers: {
					'token': token
				},
				dataType: 'json', //服务器返回json格式数据
				type: 'get', //HTTP请求类型	              
				success: function(data) {
					if(data.code == 200) {
						$('#userName').val(data.data.user_name);
						$('#phone').text(data.data.user_apliy_number);
						$('#userPassword').val(data.data.user_password);
					}else{
						mui.toast(data.msg);
					}

				},
				error: function() {
					mui.toast(data.msg);
				}
			});
			//添加个人资料
			$('.personalBtn').on('tap', function() {
				mui.ajax(config.host + '/home/User/addUserMes', {
					headers: {
						'token': token
					},
					data: {
						user_apliy_name: $('#alipayName').val(),
						user_apliy_number: $('#alipay').val(),
						number_id: $('#idCard').val(),
						user_name:$('#userName').val()
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型	              
					success: function(data) {
						if(data.code == 200) {
							mui.toast(data.msg)
							location.href = "my.html";
						} else {
							mui.toast(data.msg)
						}
					}
				});
			})
		</script>
	</body>

</html>